#%%
import numpy as np
import matplotlib.pylab as plt
#%%
def step_function(x):
    return np.array(x > 0, dtype=int)
x=np.arange(-5.0, 5.0, 0.1)
y=step_function(x)
plt.plot(x, y)
plt.show()

#%%
def sigmoid(x):
    return 1 / (1 + np.exp(-x))
x=np.arange(-5.0, 5.0, 0.1)
y=sigmoid(x)
plt.plot(x, y)
plt.show()
#%%
def relu(x):
    return np.maximum(0,x)
x=np.arange(-5.0, 5.0, 0.1)
y=relu(x)
plt.plot(x, y)
plt.show()
#%%
def softmax(a):
    c = np.max(a)
    exp = np.exp(a-c)
    sum_exp = np.sum(exp)
    return exp/sum_exp
a=np.array([0.3,2.9,4.0])
y=softmax(a)
print(y)
